#include <algorithm>
#include <cstdio>
#include <cstring>

const int N = 1005;
struct Per {
  int l, r;
  inline bool operator<(const Per& rhs) const { return l * r < rhs.l * rhs.r; }
} p[N];

int n, tmp[N];
struct Bigint {
  int num[N], len;
  inline Bigint& operator*=(int x) {
    for (int i = 1; i <= len; i++) num[i] *= x;
    for (int i = 1; i <= len; i++) {
      num[i + 1] += num[i] / 10000;
      num[i] %= 10000;
    }
    if (num[len + 1] != 0) ++len;
    return *this;
  }
  inline Bigint& operator/=(int x) {
    memset(tmp, 0, sizeof(tmp));
    int tmplen = len, r = 0;
    while (len > 0 && num[len] == 0) len--;
    bool flag = false;
    for (int i = len; i; i--) {
      r = r * 10000 + num[i];
      tmp[i] = r / x;
      if (tmp[i] == 0 && !flag)
        tmplen--;
      else
        flag = true;
      r %= x;
    }
    memcpy(num, tmp, sizeof(tmp));
    len = tmplen;
    return *this;
  }
  inline bool operator<(const Bigint& rhs) const {
    if (len != rhs.len)
      return len < rhs.len;
    else {
      for (int i = len; i; --i) {
        if (num[i] != rhs.num[i]) return num[i] < rhs.num[i];
      }
      return false;
    }
  }
} mon, maxans;

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
  freopen("国王游戏.in", "r", stdin);
  freopen("国王游戏.out", "w", stdout);
#endif
#endif
  scanf("%d", &n);
  for (int i = 0; i <= n; ++i) scanf("%d%d", &p[i].l, &p[i].r);
  std::sort(p + 1, p + n + 1);
  for (int i = 1; i <= n; ++i) {
    memset(mon.num, 0, sizeof(mon.num));
    mon.num[1] = 1, mon.len = 1;
    for (int j = 0; j < i; ++j) mon *= p[j].l;
    mon /= p[i].r;
    if (maxans < mon) maxans = mon;
  }
  printf("%d", maxans.num[maxans.len]);
  for (int i = maxans.len - 1; i > 0; --i) {
    if (maxans.num[i] == 0)
      printf("0000");
    else if (0 < maxans.num[i] && maxans.num[i] < 10)
      printf("000%d", maxans.num[i]);
    else if (9 < maxans.num[i] && maxans.num[i] < 100)
      printf("00%d", maxans.num[i]);
    else if (99 < maxans.num[i] && maxans.num[i] < 1000)
      printf("0%d", maxans.num[i]);
    else
      printf("%d", maxans.num[i]);
  }
  return 0;
}